package imaa.escola.aluno.repository;

import imaa.escola.aluno.datatransfer.PesquisaAlunoDto;
import imaa.escola.aluno.domain.Aluno;
import imaa.framework.persistence.CustomRepository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

public interface AlunoRepository extends JpaRepository<Aluno, Long>, CustomRepository<Aluno, PesquisaAlunoDto> {
	
	@Query("SELECT a FROM Aluno a WHERE LOWER(a.nome) LIKE CONCAT('%', LOWER(:nome), '%')")
    public List<Aluno> findByName(@Param("nome") String nome);
	
}
